package com.wangxs.cry.dec.utils;

import com.antherd.smcrypto.sm2.Sm2;
import com.wangxs.cry.dec.consts.CryDecConstant;

import javax.script.ScriptException;

public class CryDecUtils {

    /**
     * 解密
     * @param str
     * @return
     * @throws ScriptException
     */
    public static String doSm2Decrypt(String str) throws ScriptException {
        return Sm2.doDecrypt(str, CryDecConstant.PRIVATE_KEY);
    }

    /**
     * 加密
     * @param str
     * @return
     * @throws ScriptException
     */
    public static String doSm2Cry(String str) throws ScriptException {
        return Sm2.doEncrypt(str, CryDecConstant.PUBLIC_KEY);
    }


}
